<?php


namespace TbfDatabase\MysqlAST;


class ASTUtil{
    /**
     * @param Node[] $nodeList
     * @return string
     */
    static function joinNode(array $nodeList,$split){
        $output = '';
        $len = count($nodeList);
        for($i=0;$i<$len;$i++){
            $output.= $nodeList[$i]->GetText();
            if ($i!=$len-1){
                $output.=$split;
            }
        }
        return $output;
    }
    /**
     * @param PreparedNode[] $nodeList
     * @return string[]
     */
    static function JoinPreparedNode(array $nodeList){
        $output = array();
        foreach($nodeList as $node){
            $output = array_merge($output,$node->GetPrepareParameter());
        }
        return $output;
    }
}